
Version:=2.1_rc7
ModuleName:=openvpn

Objcet:=$(ModuleName).tgz
ObjectDir:=$(ModuleName)-$(Version)
ObjcetSource:=$(ModuleName)-$(Version).tar.gz

DependFiles:=

InstallDirTmp:=usr/local
InstallDir:=/$(InstallDirTmp)
InstallLib:=$(InstallDirTmp)/lib

Config:=./configure --prefix=$(InstallDir)

Patch:= 

.PHONY: all clean dist_clean

test:

all:$(Objcet) 

$(Objcet):$(ObjcetSource)
	tar -xzf $(ObjcetSource)
	$(Patch)
	cd $(ObjectDir) && $(Config)
	$(MAKE) -C $(ObjectDir) 
	$(MAKE) -C $(ObjectDir) install DESTDIR=`pwd`/
	rm -rf usr/local/share/
	rm -rf usr/lib && mkdir -p usr/lib && \
	cp -arf /usr/lib/liblzo2.so.2* usr/lib/
	rm -rf usr/local/etc && mkdir -p usr/local/etc/openvpn/easy-rsa && \
	cp -rf server.conf $(ObjectDir)/easy-rsa/2.0/* usr/local/etc/openvpn/easy-rsa/
	cp -rf vars usr/local/etc/openvpn/easy-rsa/
	tar -cvzf $(Objcet) usr #etc

patch:
	mv $(ObjectDir) $(ObjectDir).new
	tar xzvf $(ObjcetSource)
	diff -Nur $(ObjectDir) $(ObjectDir).new > ntop-3.3.patch

clean:
	rm -rf usr $(Objcet) etc 

dist_clean:clean
	rm -rf $(ObjectDir) $(ObjcetSource) *.tar.gz *.new
	
include ../Makefile.Res
